﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Young3.FMSearch.Core.Entities.GameVersions;
using Young3.FMSearch.Core.Offsets;
using Young3.FMSearch.Core.Managers;
using Young3.FMSearch.Core.Attributes;

namespace Young3.FMSearch.Core.Entities.InGame
{
    //[FMType(UseCache = true)]
   public class PositionalSkills : BaseObject
    {
       public PositionalSkills(int memoryAddress, IVersion version)
           : base(memoryAddress, version)
       {
       }

               public PositionalSkills(int memoryAddress, ArraySegment<byte> originalBytes, IVersion version)
            : base(memoryAddress, originalBytes, version)
        { }

       public override string ToString()
       {
           string baseString = "";

           if (this.Goalkeeper > 15) baseString += "/GK";
           if (this.Defender > 15) baseString += "/D";
           if (this.WingBack > 15) baseString += "/WB";
           if (this.DefensiveMidfielder > 15) baseString += "/DM";
           if (this.Midfielder > 15) baseString += "/M";
           if (this.AttackingMidfielder > 15) baseString += "/AM";
           if (this.Attacker > 15) baseString += "/S";

           baseString += " ";

           if (this.Right > 15) baseString += "R";
           if (this.Left > 15) baseString += "L";
           if (this.Centre > 15) baseString += "C";

           baseString = baseString.Substring(1, baseString.Length - 1);

           return baseString;
       }

       [FMEntityAttribute(PositionOffsets.Attacker)]
       public SByte Attacker { get; set; }

       [FMEntityAttribute(PositionOffsets.AttackingMidfielder)]
       public SByte AttackingMidfielder { get; set; }

       [FMEntityAttribute(PositionOffsets.Centre)]
       public SByte Centre { get; set; }

       [FMEntityAttribute(PositionOffsets.Defender)]
       public SByte Defender { get; set; }

       [FMEntityAttribute(PositionOffsets.DefensiveMidfielder)]
       public SByte DefensiveMidfielder { get; set; }

       [FMEntityAttribute(PositionOffsets.FreeRole)]
       public SByte FreeRole { get; set; }

       [FMEntityAttribute(PositionOffsets.Goalkeeper)]
       public SByte Goalkeeper { get; set; }

       [FMEntityAttribute(PositionOffsets.Left)]
       public SByte Left { get; set; }

       [FMEntityAttribute(PositionOffsets.Midfielder)]
       public SByte Midfielder { get; set; }

       [FMEntityAttribute(PositionOffsets.Right)]
       public SByte Right { get; set; }

       [FMEntityAttribute(PositionOffsets.Sweeper)]
       public SByte Sweeper { get; set; }

       [FMEntityAttribute(PositionOffsets.WingBack)]
       public SByte WingBack { get; set; }
    }

   public class NewPositionalSkills : BaseObject
   {
       public NewPositionalSkills(int memoryAddress, IVersion version)
           : base(memoryAddress, version)
       {
       }

       public NewPositionalSkills(int memoryAddress, ArraySegment<byte> originalBytes, IVersion version)
            : base(memoryAddress, originalBytes, version)
        { }

       [FMEntityAttribute(PositionOffsets.NewAttCentre)]
       public SByte AttackerCentral { get; set; }

       [FMEntityAttribute(PositionOffsets.NewAttMidCentre)]
       public SByte AttackingMidCentral { get; set; }

       [FMEntityAttribute(PositionOffsets.NewAttMidLeft)]
       public SByte AttackingMidLeft { get; set; }

       [FMEntityAttribute(PositionOffsets.NewAttMidRight)]
       public SByte AttackingMidRight { get; set; }

       [FMEntityAttribute(PositionOffsets.NewDefCentre)]
       public SByte DefenderCentral { get; set; }

       [FMEntityAttribute(PositionOffsets.NewDefLeft)]
       public SByte DefenderLeft { get; set; }

       [FMEntityAttribute(PositionOffsets.NewDefRight)]
       public SByte DefenderRight { get; set; }

       [FMEntityAttribute(PositionOffsets.NewDefMidCentre)]
       public SByte DefensiveMidfielderCentral { get; set; }

       [FMEntityAttribute(PositionOffsets.NewMidCentre)]
       public SByte MidfielderCentral { get; set; }

       [FMEntityAttribute(PositionOffsets.NewMidLeft)]
       public SByte MidfielderLeft { get; set; }

       [FMEntityAttribute(PositionOffsets.NewMidRight)]
       public SByte MidfielderRight { get; set; }

       [FMEntityAttribute(PositionOffsets.NewWingBackLeft)]
       public SByte WingBackLeft { get; set; }

       [FMEntityAttribute(PositionOffsets.NewWingBackRight)]
       public SByte WingBackRight { get; set; }
   }
}
